module(
    name = "bazel_bsp",
    version = "",
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_kotlin", version = "1.9.5")

# Required until Bazel repo upstreams it's rules_jvm_external fix and there's a new release
bazel_bep = use_extension("//:non_module_deps.bzl", "bazel_bep")
use_repo(
    bazel_bep,
    "bazel_bep",
)

bazel_dep(name = "rules_java", version = "7.6.4")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_python", version = "0.33.2")

bazel_dep(
    name = "bsp-testkit2",
    dev_dependency = True,
    repo_name = "testkit",
)
git_override(
    module_name = "bsp-testkit2",
    commit = "a5cf4603d01b0835acf28fabee201ffb22f28b2a",
    remote = "https://github.com/build-server-protocol/bsp-testkit2.git",
)

bazel_dep(
    name = "rules_bazel_integration_test",
    version = "0.23.0",
    dev_dependency = True,
)

bazel_binaries = use_extension(
    "@rules_bazel_integration_test//:extensions.bzl",
    "bazel_binaries",
    dev_dependency = True,
)

# test project are too old for bazel 7
# bazel_binaries.download(version_file = "//:.bazelversion")
bazel_binaries.download(version = "7.1.2")
bazel_binaries.download(version = "6.4.0")
bazel_binaries.download(version = "5.3.2")
use_repo(
    bazel_binaries,
    "bazel_binaries",
    "bazel_binaries_bazelisk",
    # test project are too old for bazel 7
    #     "build_bazel_bazel_.bazelversion",
    "build_bazel_bazel_5_3_2",
    "build_bazel_bazel_6_4_0",
    "build_bazel_bazel_7_1_2",
)

bazel_dep(name = "rules_jvm_external", version = "6.1")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
    name = "maven",
    artifacts = [
        "com.google.code.gson:gson:2.10.1",
        "com.google.guava:guava:31.0.1-jre",
        "ch.epfl.scala:bsp4j:2.2.0-M2",
        "commons-io:commons-io:jar:2.16.1",
        "commons-cli:commons-cli:jar:1.8.0",
        "org.apache.logging.log4j:log4j-api:2.23.1",
        "org.apache.logging.log4j:log4j-core:2.23.1",
        "org.apache.velocity:velocity-engine-core:2.3",
        "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1",
        "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1",
        "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0",
        "org.slf4j:slf4j-nop:1.7.36",  # cannot be 2.0.0+ unless slf4j-api dependency in velocity-engine-core is 2.0.0+
        "com.fasterxml.jackson.core:jackson-databind:2.17.1",
        "com.fasterxml.jackson.module:jackson-module-kotlin:2.17.1",
        "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.4",
        "com.google.protobuf:protobuf-java:3.25.3",
        "io.grpc:grpc-stub:1.64.0",
        "io.grpc:grpc-protobuf:1.64.0",
        "io.opentelemetry:opentelemetry-api:1.39.0",
        "io.opentelemetry:opentelemetry-extension-kotlin:1.39.0",
        "io.opentelemetry:opentelemetry-exporter-otlp:1.39.0",
        "io.opentelemetry:opentelemetry-sdk:1.39.0",
        "io.opentelemetry:opentelemetry-sdk-trace:1.39.0",
        "io.opentelemetry.semconv:opentelemetry-semconv:1.25.0-alpha",

        # tests
        "org.junit.jupiter:junit-jupiter:5.10.2",
        "org.junit.platform:junit-platform-console:1.10.2",
        "io.kotest:kotest-assertions-api-jvm:5.9.1",
        "io.kotest:kotest-assertions-core-jvm:5.9.1",
        "io.kotest:kotest-assertions-shared-jvm:5.9.1",
        "io.kotest:kotest-common-jvm:5.9.1",
    ],
    fail_if_repin_required = True,
    fetch_sources = True,
    lock_file = "//:maven_install.json",
    repositories = [
        "https://repo.maven.apache.org/maven2",
    ],
)
use_repo(
    maven,
    "maven",
    "unpinned_maven",
)
